package com.weibo.hibernate;
//abcdefghijk  wyf

import java.util.Iterator;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Session session = null;
		Configuration config=null;
		SessionFactory factory = null;
		Transaction tran=null;

		config = new Configuration().configure();
		factory = config.buildSessionFactory();
		session = factory.openSession();

		PersonInfo p=new PersonInfo();
		p.setRegName("330737687@qq.com");
		p.setUserName("gaoguan");
		p.setPassword("1234");
		p.setGender(true);
		p.setEmail("3307@qq.com");
		tran = session.beginTransaction();
		session.saveOrUpdate(p);
		tran.commit();
		
//		PersonInfo p2=(PersonInfo)session.get(PersonInfo.class, "1234");
//		System.out.println(p2.getEmail());
	}

}
